$(function(){
 
  // 登录
  var form = layui.form
  $('.layui-form').submit(function(e){
    e.preventDefault()
    var fdd = $(this).serialize()
    $.ajax({
      type:'post',
      url: 'api/login',
      data: fdd,
      success:function(res){
        //跳转
        if(res.status ===0){
          localStorage.setItem('mytoken',res.token)
          location.href = './index.html'
        } else{
          // 失败
          layer.msg(res.message)
        }
      }
    })
  })
})
